<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAdminTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('admin', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name')->comment('管理员名字');
            $table->string('number')->comment('手机号');
            $table->string('password')->comment('管理员密码');
            $table->unsignedBigInteger('image')->comment('头像')->nullable();
            $table->foreign('image')->references('id')->on('file_upload')->onDelete('set null');
          $table->timestamps();
        });
        Schema::create('logo', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name')->comment('管理员名字');
            $table->unsignedBigInteger('logo')->comment('图片')->nullable();
            $table->foreign('logo')->references('id')->on('file_upload')->onDelete('set null');
             $table->timestamps();
        });
        Schema::create('admin_class', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name')->comment('地址信息');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('admin_class');
        Schema::dropIfExists('logo');
        Schema::dropIfExists('admin');
    }
}
